/**
 * 与lua脚本交互
 * @type {{}}
 */
var luaFuncs={
    /**
     * 卡号密码
     * @param username
     * @param password
     * @return
     */
    input_account: function (username, password) {
        var map = new HashMap();
        map.put("method", "input_account");
        map.put("username", username);
        map.put("password", password);
        return sendAndReceive(map);
    },
    /**
     * 设置窗口大小
     * @return
     */
    setSize:function(){
        var map=new LinkedHashMap();
        map.put("method", "setSize");
        return sendAndReceive(map);
    },
    /**
     * 根据url地址进行跳转
     * @return
     */
    jumpByUrl:function (url) {
        var map=new LinkedHashMap();
        map.put("url", url);
        map.put("method", "jumpByUrl");
        return sendAndReceive(map);
    },
    /**
     * 输入图片验证码
     * @param code
     * @param inputId
     * @returns {*}
     */
    abcSetInputEvent: function (code, inputId) {
        var map = new LinkedHashMap();
        map.put("method", "abcSetInputEvent");
        map.put("code",code);
        map.put("inputId", inputId);
        return sendAndReceive(map);
    },
    /**
     * 等待跳转的url
     * @returns {*}
     */
    waiting_Goto: function (hostMills) {
        var map = new LinkedHashMap();
        map.put("method", "waiting_Goto");
        map.put("hostMills",hostMills)
        return sendAndReceive(map);
    },
    /**
     * 增加等待页面加载时间
     * @param time
     * @returns {*}
     */
    sleep_Wait: function () {
        var map = new LinkedHashMap();
        map.put("method", "sleep_Wait");
        return sendAndReceive(map);
    },
    /**
     * ajax获取文件下载的方法
     * @return 是否登录成功的标志
     * @throws Exception
     */
    ajaxGetFile:function (url,datas) {
        var  map=new LinkedHashMap();
        map.put("method", "ajaxGetFile");
        map.put("url",url);
        map.put("data", datas);
        return sendAndReceive(map);
    },
    /**
     * 登录用户名和密码输入
     * @param username
     * @param password
     * @return
     * @throws Exception
     */
    loginUsernameAndPassowrd:function(username,password, taskKey)  {
        var map=new LinkedHashMap();
        map.put("method", "loginUsernameAndPassword");
        map.put("username", username);
        map.put("password", password);
        map.put("taskKey", taskKey);
        lp.Send(JSON.toJSONString(map));
        var anonymousPassword = getAnonymousString(password);
        var anonymousUsername=getAnonymousString(username);
        map.put("password", anonymousPassword);
        map.put("username", anonymousUsername);
        logger.info("send msg : {}", JSON.toJSONString(map));
        return lp.Receive();

    },
    /**
     * 增加等待页面加载时间
     * @param time
     * @returns {*}
     */
    click_fashion_button: function () {
        var map = new LinkedHashMap();
        map.put("method", "click_fashion_button");
        return sendAndReceive(map);
    }
}